<template>
  <div>
    御剑乘风来,除魔天地间! ==== Son.vue === {{ msg }} ===={{ bb }}==={{ nn }}
    <button @click="Changevalue">按键传参</button>
    <button @click="ChangeFather">按键改参</button>
    <button @click="ChangeFathereasy">按键改参--简易版</button>
  </div>
</template>
<script>
export default {
  name: '',
  props: {
    msg: {
      //类型判断，不满足条件则报错，但是还会输出
      type: String,
      //设置默认值
      default: '123',
      //设置是否必须传参
      required: false
    },
    bb: {
      type: String,
      default: '',
      required: false
    },
   nn:Number
  },
  data () {
    return {
      pp:'擦浪嘿有'
    }
  },
  created () {
  },
  computed: {
  },
  methods: {
    Changevalue(){
      this.$emit('Sonvalue',this.pp)
    },
    ChangeFather(){
      //父亲传给儿子的参数在儿子里面不能直接更改
      // 先传想改的参给父亲，在父亲里面修改后，再有父亲传回
      this.$emit('ChangeFather','bb====修改啦')
    },
    ChangeFathereasy(){
     this.$emit('update:nn',456)
    }
  }
}
</script>
<style lang='less'  scoped>
</style>
